<template>
  <view class="emoji-icon" @click="onClick">
    <text class="emoji-text">😊</text>
    <text v-if="label" class="emoji-label">{{ label }}</text>
  </view>
</template>

<script>
export default {
  name: 'EmojiIcon',
  props: {
    size: {
      type: [Number, String],
      default: 24
    },
    color: {
      type: String,
      default: '#999'
    },
    label: {
      type: String,
      default: ''
    }
  },
  computed: {
    iconStyle() {
      return {
        fontSize: this.size + 'px',
        color: this.color
      }
    }
  },
  methods: {
    onClick() {
      this.$emit('click')
    }
  }
}
</script>

<style lang="scss" scoped>
.emoji-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  
  .emoji-text {
    font-size: v-bind('iconStyle.fontSize');
    color: v-bind('iconStyle.color');
    line-height: 1;
  }
  
  .emoji-label {
    margin-left: 4px;
    font-size: 14px;
    color: v-bind('iconStyle.color');
  }
}
</style>